<!--奖品列表-->
<template>
  <el-card shadow="never">
    <div class="flex-between m-bottom20">
      <div class="fit-title">充值记录</div>
    </div>
    <el-table
      max-height="273px"
      :data="tableData"
      ref="table"
      tooltip-effect="dark"
      border
      stripe>
      <el-table-column  label="充值代理" align="center">
        <template slot-scope="scope">
          <div>{{scope.row.oemCode}}</div>
        </template>
      </el-table-column>
      <el-table-column label="充值余额">
        <template slot-scope="scope">
          <div>{{scope.row.balance}}</div>
        </template>
      </el-table-column>T
      <el-table-column label="充值时间">
        <template slot-scope="scope">
          <div>{{scope.row.createTime}}</div>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-link
            type="danger"
            :underline="false"
            @click="delSingle(scope.row)"
          >
            删除
          </el-link>
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import { balanceRecordPageId, rechargeDelete } from '@/api/oem';
  export default {
    name: "prize",
    props:{
      id:Number
    },
    created(){
      console.log("进入子组件========")
      },
    data() {
      return {
        // 上传背景图片url
        fileList:[],
        // 背景图
        imageUrl: '',
        list:[],
        tableData: []
      }
    },
    methods:{
      clear(){
        this.tableData=[]
      },
      show() {
        /* 获取角色数据 */
        balanceRecordPageId(this.id)
          .then((data) => {
            console.log("toSonData============>", data);
            this.tableData=data.data
          })
          .catch((e) => {
            this.$message.error(e.message);
          });
      },
      // 删除
      delSingle(item){
        console.log("item",item)
        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          //  多个删除使用：ids:[1,3]格式，单个删除：id：1
          let ids =[]
          ids.push(item.id)
          console.log("ids",ids)
          rechargeDelete({
            ids:ids
          })
            .then((data) => {
              this.$message.success(data)
              this.show()
              console.log("toSonData============>", data);
            })
            .catch((e) => {
              this.$message.error(e.msg);
            });
        }).catch(() => {
          this.$message.info('已取消删除')
        });
      },
    }
  }
</script>

<style scoped lang="less">
  .fit-title{
    color: #333333;
    font-size: 16px;
    margin:0px 2px;
  }
  .tj-class{
    margin: 30px 10px 0;
  }
  .avatar-uploader{
    margin: 0;
    padding: 0;
    outline: none;

    /* 修改 start*/
    border: 1px solid #D9D9D9;
    border-radius: 2px;
    /*end*/
    width: 88px;
    height: 88px;
  }
  /*  ‘背景图’上传 start */
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    color: #D9D9D9;
    text-align: center;
    i{
      font-size: 28px;
    }
    div{
      padding-top: 3px;
    }
  }
  .avatar {
    width: 90px;
    height: 90px;
    display: block;
  }
/*  end*/
</style>
